from django.db import models
from datetime import datetime


class PlatformSubscriber(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='关联账户表id')
    user_id = models.IntegerField(null=False, blank=False, verbose_name='本平台用户id')
    platform = models.CharField(verbose_name='关联平台', max_length=30)
    platform_login_type = models.CharField(null=False, blank=False, verbose_name='关联平台登录方式', max_length=30)
    platform_username = models.CharField(null=False, blank=False, verbose_name='关联平台用户名', max_length=30)
    platform_password = models.CharField(null=False, blank=False, verbose_name='关联平台密码', max_length=30)
    platform_status = models.CharField(null=False, blank=False, verbose_name='状态', max_length=1, default=0)
    create_time = models.DateTimeField(verbose_name='创建时间', default=datetime.now)
    update_time = models.DateTimeField(verbose_name='修改时间', default=datetime.now)

    class Meta:
        verbose_name = '关联账户表'

    def __str__(self):
        d = vars(self)
        d.pop('_state', '')
        return str(d)
